<!--
 * @Descripttion:
 * @version:
 * @Author: YouHuJun
 * @Date: 2021-10-11 16:28:38
 * @LastEditors: youhujun 2900976495@qq.com
 * @LastEditTime: 2025-05-05 22:12:15
-->
<template>
  <div>
    <Card>
      <template #cardTitle>
        产品分类关联
      </template>
      <template #cardNotice>
        <el-tag size="mini" type="danger" effect="plain">这是业务系统配置,配置添加商品时选择商品分类,该分类需要必填的规格和属性</el-tag>
      </template>
      <template #cardContent>
        <div class="custom-node">
          <el-button type="primary" plain @click="handleToBind(0)">绑定规格名</el-button>
          <el-button type="primary" plain @click="handleToBind(1)">绑定属性名</el-button>
        </div>
      </template>
    </Card>
    <!-- 弹框开始 -->
    <Dialog :dialog-visible.sync="dialogVisible" :dialog-title="dialogTitle" :dialog-type="dialogType" :dialog-width="dialogWidth">
      <template #addForm>
        <!-- <AddRoleForm :new-add-role-from="newAddRoleFrom" :role-array.sync=" roleArray" /> -->
      </template>
      <template #updateForm>
        <!--  <UpdateRoleForm :before-role-form="beforeRoleForm" :role-array.sync=" roleArray" /> -->
      </template>
    </Dialog>
  </div>
</template>
<script>
import Card from '@/pages/component/laravel-fast-api/v1/card'
import Dialog from '@/pages/component/laravel-fast-api/v1/dialog'

export default
{
  // 组件名称
  name: 'GoodsClassUnion',
  // 组件
  components:
  {
    Card,
    Dialog
  },
  props:
  {
  },
  // 数据
  data()
  {
    return {
      // 产品分类id
      goods_class_id: 0,
      // 弹窗控制
      dialogVisible: false,
      dialogWidth: '60%',
      dialogTitle: '添加顶级地区',
      // 表单类型 1添加表单 2更新表单
      dialogType: 1,
      // 默认tree显示
      defaultProps:
      {
        children: 'children',
        label: (data, node) =>
        {
          return `${data}`
        }
      },
      // 用户级别显示容器,
      regionArray: [],
      // 添加自己用户级别用的容器
      newAddRegionFrom: {},
      // 修改用户级别的容器
      beforeRegionForm: {}
    }
  },
  // 计算属性
  computed:
  {
  },
  // 监听
  watch:
  {
  },
  // 实例创建之前
  beforeCreate()
  {
  },
  // 创建
  created()
  {
  },
  // 挂载之前
  beforeMount()
  {
  },
  // 挂载 --常用
  mounted()
  {
    this.goods_class_id = this.$route.query.goods_class_id

    console.log('goods_class_id:')
    console.log(this.goods_class_id)
  },
  // 更新之前
  beforeUpdate()
  {
  },
  // 跟新后
  updated()
  {
  },
  // 销毁之前
  beforeDestroy()
  {
  },
  // 销毁后
  destroyed()
  {
  },
  // 方法
  methods:
  {
    handleToBind(param)
    {
      const navigateRoute = ['bindSpecName', 'bindAttributeName']
      this.$router.push({ name: navigateRoute[param], query: { goods_class_id: this.goods_class_id }})
    }

  }
}
</script>
<style lang='scss' scoped>
</style>
